<%--***************************************************************************	
    Created By		: Novan Ananda
    Template        : BBApp_MainScreen
 	Date created 	: 20 Aug 2010 
 	Module 	        : Simas Widget
 	Comments 		: Simas Widget
 --------------------------------------------------------------------------------
 DATE			PROGRAMMER			REMARKS
 --------------------------------------------------------------------------------
 20 Aug 2010	Novan Ananda		Initial Version
 -------------------------------------------------------------------------------- --%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> 
<%@ page import="java.util.*, blackberryAppCom.*, blackberryApp.BBApp_cjbREG_MAIN"%>
<jsp:useBean id="lObjBBApp_cjbBBApp" class="blackberryApp.BBApp_cjbBBApp" scope= "request"/>

<%	
try { 
		String lStrLocalPath 	= BBApp_Common.fnGetProperty("LOCAL_PATH");
		String lStrLanguage 	= "IN";
		
		String strNama 			= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrNama());
		String strTglLahir 		= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrTglLahir());
		
		String strNoKartu		= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrNoKartu());
		String strNoPolis		= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrNoPolis());
		String strNoReg			= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrNoReg());
		String strUmur			= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrUmur());
		String strPerusahaan 	= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrPerusahaan());
		
		String strProgramId		= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrProgramId());
		String strPlanId		= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrPlanId());
		String strProgramName	= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrProgramName());
		String strPlanName	 	= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrPlanName());
		
		String strMaxNo			= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrMaxNo());
		String strRecNo			= BBApp_Common.fnGetValue(lObjBBApp_cjbBBApp.getStrRecNo());
		
%>

<HTML>
<HEAD>
	<title >Simas Multi Claim Information System</title>
	
	<META HTTPS-EQUIV="Pragma" CONTENT="no-cache">
	<META HTTPS-EQUIV="Expires" CONTENT="-1">
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<link href="<%=lStrLocalPath%>css/novStyles.css" rel="stylesheet">
	<script type="text/javascript" src="<%=lStrLocalPath%>js/BBApp_Common.js"></script>	
	<script type="text/javascript" src="<%=lStrLocalPath%>js/novan_tools.js"></script>
	<script type="text/javascript" src="<%=lStrLocalPath%>js/calendar.js"></script>
	<script type="text/javascript" src="<%=lStrLocalPath%>js/calendar-en.js"></script>
	<script type="text/javascript" src="<%=lStrLocalPath%>js/calendar-setup.js"></script>
	
	<style type="text/css">
		img {
			border-style: none;
		}
		tr {
			font-size: x-small;
		}
		td {
			font-size: x-small;
		}
		.header {
			font-size: x-small;
			font-weight: bold;
			background: #d2b48c;
			color: black;
			text-align: center;
			vertical-align: middle;
		}
		.text {
			font-size: x-small;
			font-weight: normal;
			text-align: left;
			vertical-align: top;
		}
		.number {
			font-size: x-small;
			font-weight: normal;
			text-align: right;
			vertical-align: top;
		}
	</style>
	
	<script type="text/javascript">
		function fnViewPolis() {
			document.main_form.hidMode.value = 2;
	        document.main_form.method = "POST";
	        document.main_form.action = "<%= lStrLocalPath %>BBApp_cMainScreen";
	        document.getElementById("divStayTopLeft").style.visibility = "visible";
			document.main_form.submit();
		}
		
		function fnShowDetail(vProgId, vPlanId, vProgName, vPlanName) {
			document.main_form.hidProgramId.value = vProgId;
			document.main_form.hidPlanId.value = vPlanId;
			document.main_form.hidProgramName.value = vProgName;
			document.main_form.hidPlanName.value = vPlanName;
		
			document.main_form.hidMode.value = 3;
	        document.main_form.method = "POST";
	        document.main_form.action = "<%= lStrLocalPath %>BBApp_cMainScreen";
	        document.getElementById("divStayTopLeft").style.visibility = "visible";
			document.main_form.submit();
		}

		//function fnLoginScreen() {
		//	document.main_form.hidMode.value = 4;
	    //  document.main_form.method = "POST";
	    //  document.main_form.action = "<--%= lStrLocalPath %>BBApp_cMainScreen";
		//	document.main_form.submit();
		//}
		
		function fnViewKlaim() {
			document.main_form.hidMode.value = 5;
	        document.main_form.method = "POST";
	        document.main_form.action = "<%= lStrLocalPath %>BBApp_cMainScreen";
	        document.getElementById("divStayTopLeft").style.visibility = "visible";
			document.main_form.submit();
		}

		function fnPrevNext(btType) {
			var vMaxNo = '<%= strMaxNo %>';
			var vCurrRecNo = '<%= strRecNo %>';
			var vNewRecNo;
			if (btType == 'prev') {
				vNewRecNo = parseInt(vCurrRecNo) - 1;
				if (vNewRecNo < 1) {
					vNewRecNo = 1;
				}
			} else if (btType == 'next') {
				vNewRecNo = parseInt(vCurrRecNo) + 1;
				if (vNewRecNo > vMaxNo) {
					vNewRecNo = parseInt(vMaxNo);
				}
			}
			document.main_form.hidRecNo.value = vNewRecNo;
			document.main_form.hidMode.value = 5;
	        document.main_form.method = "POST";
	        document.main_form.action = "<%= lStrLocalPath %>BBApp_cMainScreen";
	        document.getElementById("divStayTopLeft").style.visibility = "visible";
			document.main_form.submit();
		}

		function fnGetXML() {
			document.main_form.hidMode.value = 4;
	        document.main_form.method = "POST";
	        document.main_form.action = "<%= lStrLocalPath %>BBApp_cMainScreen";
	        document.getElementById("divStayTopLeft").style.visibility = "visible";
			document.main_form.submit();
		}
	</script>
</HEAD>
<BODY>
	<form name="main_form">
	<input type="hidden" name="hidMode" id="hidMode">
	<input type="hidden" name="hidNoKartu" id="hidNoKartu" value="<%= strNoKartu %>">
	<input type="hidden" name="hidNoPolis" id="hidNoPolis" value="<%= strNoPolis %>">
	<input type="hidden" name="hidNoReg" id="hidNoReg" value="<%= strNoReg %>">
	<input type="hidden" name="hidNama" id="hidNama" value="<%= strNama %>">
	<input type="hidden" name="hidTglLahir" id="hidTglLahir" value="<%= strTglLahir %>">
	<input type="hidden" name="hidUmur" id="hidUmur" value="<%= strUmur %>">
	<input type="hidden" name="hidPerusahaan" id="hidPerusahaan" value="<%= strPerusahaan %>">
	
	<input type="hidden" name="hidProgramId" id="hidProgramId" value="<%= strProgramId %>">
	<input type="hidden" name="hidPlanId" id="hidPlanId" value="<%= strPlanId %>">
	<input type="hidden" name="hidProgramName" id="hidProgramName" value="<%= strProgramName %>">
	<input type="hidden" name="hidPlanName" id="hidPlanName" value="<%= strPlanName %>">
	
	<input type="hidden" name="hidMaxNo" id="hidMaxNo" value="<%= strMaxNo %>">
	<input type="hidden" name="hidRecNo" id="hidRecNo" value="<%= strRecNo %>">
	
	<table>
	<!--
		<tr>
			<td colspan="3">
				<a href="#" onclick="fnLoginScreen()"><img src="http://localhost:8080/SimasServerBB/images/logoASM.png"></img></a>
			</td>
		</tr>
		<tr>
    		<td colspan="3">
    			<hr width="100%" style="color: red;"></hr>
    		</td>
    	</tr>
    -->
		<tr>
			<td>No Kartu</td>
			<td>&nbsp;:&nbsp;</td>
			<td><%= strNoKartu %></td>
		</tr>
		<tr>
			<td>No Polis / No Reg</td>
			<td>&nbsp;:&nbsp;</td>
			<td><%= strNoPolis %> / <%= strNoReg %></td>
		</tr>
		<tr>
			<td>Nama</td>
			<td>&nbsp;:&nbsp;</td>
			<td><%= strNama %></td>
		</tr>
		<tr>
			<td>Tgl Lahir</td>
			<td>&nbsp;:&nbsp;</td>
			<td><%= strTglLahir %>&nbsp;(&nbsp;<%= strUmur %>&nbsp;tahun&nbsp;)</td>
		</tr>
		<tr>
			<td>Perusahaan</td>
			<td>&nbsp;:&nbsp;</td>
			<td><%= strPerusahaan %></td>
		</tr>
		<tr>
			<td colspan="3">
				<button type="button" name="btViewPolis" id="btViewPolis" onclick="fnViewPolis()"><font style="font-size: x-small;">Info Polis</font></button>
				&nbsp;
				<button type="button" name="btViewKlaim" id="btViewKlaim" onclick="fnViewKlaim()"><font style="font-size: x-small;">Info Klaim</font></button>
			</td>
		</tr>
		<!-- START: BAGIAN UNTUK MENAMPILKAN DATA KLAIM -->
		<%
			if (request.getSession().getAttribute("lHstDataClaim") != null) {
				Hashtable lHstDataClaim = (Hashtable) request.getSession().getAttribute("lHstDataClaim");
				Hashtable lHstReg = new Hashtable();
				Hashtable lHstLetter = new Hashtable();
				
				if(lHstDataClaim == null || lHstDataClaim.size() == 0 ) {
					lHstDataClaim = new Hashtable();
				} else {
					lHstReg = (Hashtable) lHstDataClaim.get("Register"); 
					//lHstLetter = (Hashtable) lHstDataClaim.get("Letter");
				}
				//Hashtable lHstReserveType = (Hashtable) request.getSession().getAttribute("RESERVE_TYPE_CLAIM_VALUE");
		%>
				<tr>
					<td colspan="3">
						<table border="0" width="100%">
							<%
								int length = lHstReg.size();
								String lStrProposed = "";
						  		String lStrClmAccepted = "";
						  		long lProposed = 0;
						  		long lAccept = 0;
						  		int intRow = 1;
						  	 	for(int i = 1; i <= lHstReg.size(); i++ ) {
						 			BBApp_cjbREG_MAIN lObjReg = (BBApp_cjbREG_MAIN)lHstReg.get(""+i);
						 			
						 			int intColorIdx = intRow % 2;
			    					String strBgColor;
			    					if (intColorIdx == 0) {
			    						strBgColor = "style=\"background-color: #f5f5dc;\"";
			    					} else {
			    						strBgColor = "style=\"background-color: #f5deb3;\"";
			    					}
							%>
									<tr>
										<td colspan="4">
											<font class="text">
												<%= strRecNo %>/<%= strMaxNo %>
												&nbsp;<b>Tgl Klaim:</b>&nbsp;<%=BBApp_Common.fnGetDateDDMMMYYYY(lObjReg.getREG_DATE())%>
											</font>
										</td>
									</tr>
						 			<tr class="header">
										<td>No Klaim</td>
										<td>Nilai Pengajuan</td>
										<td>Nilai Akseptasi</td>
										<td>Tgl Lunas</td>
									</tr>
						 			<tr <%= strBgColor %>>
						 				<td class="text"><%=BBApp_Common.fnGetValue(lObjReg.getCLAIM_NO())%></td>
							  			<td class="number"><%=BBApp_Common.fnFormatNumberInd(lObjReg.getTOTAL_AMT())%></td>
							  			<td class="number"><%=BBApp_Common.fnFormatNumberInd(lObjReg.getTOTAL_APPROVE())%></td>
							  			<td class="text"><%=BBApp_Common.fnGetDateDDMMMYYYY(BBApp_Common.fnGetValue(lObjReg.getDISCHRG_DATE()))%></td>
							  		</tr>
							  		<tr <%= strBgColor %>>
							  			<td colspan="4">
							  				<table>
							  					<tr>
							  						<td class="text">Rumah Sakit</td>
							  						<td class="text">&nbsp;:&nbsp;</td>
							  						<td class="text"><%=BBApp_Common.fnGetValue(lObjReg.getHOSP_CODE())%></td>
							  					</tr>
							  					<tr>
							  						<td class="text">Jenis Perawatan</td>
							  						<td class="text">&nbsp;:&nbsp;</td>
							  						<td class="text"><%=BBApp_Common.fnGetValue(lObjReg.getRESERVE_TYPE())%></td>
							  					</tr>
							  					<tr>
							  						<td class="text">Kode Diagnosa</td>
							  						<td class="text">&nbsp;:&nbsp;</td>
							  						<td class="text"><%=BBApp_Common.fnGetValue(lObjReg.getDIAGNOSA())%></td>
							  					</tr>
							  				</table>							  				
							  			</td>
							  		</tr>
							  		<tr>
							  			<td class="header" colspan="4">
							  				<%=BBApp_Common.fnGetValue(lObjReg.getCLM_STAT())%>
							  			</td>
							  		</tr>
							  		<!-- 
							  		<tr>
							  			<td colspan="4">&nbsp;</td>
							  		</tr>
							  		 -->
						 	<%
						 			lProposed += Long.parseLong(lObjReg.getTOTAL_AMT()); 	
						  			lAccept += Long.parseLong(lObjReg.getTOTAL_APPROVE());
						  			intRow = intRow + 1;
						 		}
						 		
								lStrProposed = ""+lProposed;
						  		lStrClmAccepted = ""+lAccept;
						  		
						  		//if (length>0) {
						  	%>
						  			<!-- 
						  			<tr>
						  				<td colspan="4">
						  					<font class="text"><b>Total Nilai Pengajuan:</b>&nbsp;Rp&nbsp;<--%=BBApp_Common.fnFormatNumberInd(lStrProposed)%></font>
						  				</td>
						  			</tr>
						  			<tr>
						  				<td colspan="4">
						  					<font class="text"><b>Total Nilai Akseptasi:</b>&nbsp;Rp&nbsp;<--%=BBApp_Common.fnFormatNumberInd(lStrClmAccepted)%></font>
						  				</td>
						  			</tr>
						  			 -->
						  	<%
						  		//}
							%>
							
							<tr>
								<td colspan="4" align="left">
									<button type="button" name="btPrev" id="btPrev" onClick="fnPrevNext('prev')">Prev</button>
									&nbsp;
									<button type="button" name="btNext" id="btNext" onClick="fnPrevNext('next')">Next</button>
									&nbsp;
									<button type="button" name="btNext" id="btNext" onClick="fnGetXML()">Get XML</button>
								</td>
							</tr>
						</table>
					</td>
				</tr>
		<%
			}
		%>
		<!-- END: BAGIAN UNTUK MENAMPILKAN DATA KLAIM -->
		
		<!-- START: BAGIAN UNTUK MENAMPILKAN DATA POLIS -->
		<%
			if (request.getSession().getAttribute("lHstDataPolis") != null) {
				Hashtable lHstDataPolis = (Hashtable) request.getSession().getAttribute("lHstDataPolis");
				Hashtable lHstPlanNew = (Hashtable) lHstDataPolis.get("NEW_PLAN");
				Hashtable lHstPlanOld = (Hashtable) lHstDataPolis.get("OLD_PLAN");
		%>
				<tr>
					<td colspan="3">
						<table border="0" width="100%">
			          		<tr class="header">
			          			<td>Plan</td>
			          			<td>Premium (Rp)</td>
			          			<td>Sisa Limit Thn (Rp)</td>
			          		</tr>
			          		<%
			          			int length = lHstPlanNew.size();
			          			int intRow = 1;
			          			for(int i = 1; i <= length; i++) {
			          				String[] st = (String[])lHstPlanNew.get(""+i);
			          				
			          				int intColorIdx = intRow % 2;
			    					String strBgColor;
			    					if (intColorIdx == 0) {
			    						strBgColor = "style=\"background-color: #f5f5dc;\"";
			    					} else {
			    						strBgColor = "style=\"background-color: #f5deb3;\"";
			    					}
			          		%>
			          				<tr <%= strBgColor %>>
			          					<td class="text"><a href="#" onclick="fnShowDetail('<%=st[4]%>', '<%=st[5]%>','<%=st[0]%>','<%=st[1]%>')"><%=st[1]%></a></td>
			          					<td class="number"><%=BBApp_Common.fnFormatNumberInd(st[3])%></td>
			          					<td class="number"><%=BBApp_Common.fnFormatNumberInd(st[6])%></td>
			          				</tr>		
			          		<%
			          				intRow = intRow + 1;
			          			}	
			          		%>
			          	</table>
					</td>
				</tr>		
		<%
			}
		%>
		<%
			if (request.getSession().getAttribute("DATA_BENEFIT") != null) {
				String lStrProgName = BBApp_Common.fnGetValue((String)request.getSession().getAttribute("PROG_NAME"));
				String lStrPlanName = BBApp_Common.fnGetValue((String)request.getSession().getAttribute("PLAN_NAME"));
				Hashtable lHstData = (Hashtable) request.getSession().getAttribute("DATA_BENEFIT");
		%>
				<tr>
					<td colspan="3">
						<table>
							<tr>
								<td>Program</td>
								<td>&nbsp;:&nbsp;</td>
								<td><%= lStrProgName %></td>
							</tr>
							<tr>
								<td>Plan</td>
								<td>&nbsp;:&nbsp;</td>
								<td><%= lStrPlanName %></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<table border="0" width="100%">
							<tr class="header">
								<td>Benefit Name</td>
								<td>Limit (Rp)</td>
							</tr>
							<%
								int length = lHstData.size();
								int intRow = 1;
								for(int i = 1; i <= length; i++) {
									String[] st = (String[])lHstData.get(""+i);
									
									int intColorIdx = intRow % 2;
			    					String strBgColor;
			    					if (intColorIdx == 0) {
			    						strBgColor = "style=\"background-color: #f5f5dc;\"";
			    					} else {
			    						strBgColor = "style=\"background-color: #f5deb3;\"";
			    					}
							%>
									<tr <%= strBgColor %>>
										<td class="text"><%=st[0]%></td>
										<td class="number"><%=BBApp_Common.fnFormatNumberInd(st[1])%></td>
									</tr>
							<%
									intRow = intRow + 1;
								}
							%>
						</table>
					</td>
				</tr>
		<%
			}
		%>
		<!-- END: BAGIAN UNTUK MENAMPILKAN DATA POLIS -->
	</table>
	</form>
	
	<script language="JavaScript" src="<%=lStrLocalPath%>js/waterMark0.js"></script>
	<layer id="divStayTopLeft">
		<jsp:include page="/novan_SplashScreen.jsp" />
	</layer>
	<script language="JavaScript" src="<%=lStrLocalPath%>js/waterMark.js"></script>
	
</BODY>
</HTML>

<%
}
catch(Exception e) {
	BBApp_Common.fnWriteLog("BBApp_MainScreen","BBApp_MainScreen[JSP]: ","Exception in BBApp_MainScreen: "+ e);
  	request.setAttribute("ErrorCode","2000");
%>
	<jsp:forward page="/UTIL_cERRORPAGE"></jsp:forward>
<%	
}
%>

